<?php
/**
 * OptionsArray
 * -e
 * -e <value>
 * --long-param
 * --long-param=<value>
 * --long-param <value>
 *
 * @key   short-param -k
 * @value long-param  --value
 */
$optionsArray = array(
	'a:' => 'application:',
	'm:' => 'module:',
	'c:' => 'controller:'
);

$options = getopt(
	implode('', array_keys($optionsArray)),
	$optionsArray
);

/**
 * Class Create
 */
class Create {
	public static $application = null;
	private static $_options = false;
	
	public static function run($options) {
		self::$_options = $options;
		if(is_array($options)) {
			foreach($options as $key => $value) {
				if(is_array($value)) {
					foreach($value as $_value) {
						self::_switch($key, $_value);
					}
				} else {
					self::_switch($key, $value);
				}
			}
		}
	}
	
	private static function _switch($key, $value) {
		switch($key) {
			case 'a':
			case 'application':
				if(empty(self::$application))
					self::_application($value);
				else
					break;
				break;
			case 'm':
			case 'module':
				self::_module($value);
				break;
			case 'c':
			case 'controller':
				if(!empty(self::$application))
					self::_controller($value);
				break;
		}
	}
	
	private static function _application($value) {
		echo 'module: '.$value."\n";
	}
	
	private static function _module($value) {
		echo 'module: '.$value."\n";
	}
	
	private static function _controller($value) {
		echo 'controller: '.$value."\n";
	}
}

print_r( Create::run($options) );
print_r($options);